<template>
  <div class="container flex-row">
    <img :src="leftSrc" @click="onLeft" class="navi-icon navi-left" />
    <span class="title">{{title}}</span>
    <img :src="rightSrc" @click="onRight" class="navi-icon navi-right" />
  </div>
</template>

<script>
  export default {
    name: 'BotBlock',
    props: {
      title: String,
      isFirst: {
        type: Boolean,
        default: true
      },
      isLast: {
        type: Boolean,
        default: false
      }
    },
    computed: {
      leftSrc () {
        return this.isLast ? '' : '/static/btn-icon/prev@2x.png'
      },
      rightSrc () {
        return this.isFirst ? '' : '/static/btn-icon/next@2x.png'
      }
    },
    methods: {
      onLeft () {
        if (this.isLast) return
        this.$emit('prev')
      },
      onRight () {
        if (this.isFirst) return
        this.$emit('next')
      }
    }
  }
</script>

<style lang="stylus" scoped>
  .container
    width 600rpx
    height 80rpx
    background-color #f7f7f7
    border-radius 2px
    .navi-icon
      width 30rpx
      height 30rpx
      margin 0 20rpx
    .title
      font-size 28rpx
</style>
